/**
 * edurender
 * er_hashtable.h
 * (c) 2009 J. Brad Byrd
 */

#ifndef ER_HASHTABLE_H
#define ER_HASHTABLE_H

#include "er_types.h"

typedef struct ERHashTable ERHashTable;
typedef void *ERHashTableIterator;

typedef ERuint (*ERHashFunc)(const void *key, ERuint size);
typedef ERbool (*EREqualityFunc)(const void *keyA, ERuint sizeA, const void *keyB, ERuint sizeB);
typedef ERbool (*ERHashTableIteratorFunc)(const void *key, ERuint keySize, const void *value);

ERHashTable *erCreateHashTable(ERHashFunc hashFunc, EREqualityFunc equalityFunc);
void erDestroyHashTable(ERHashTable *ht);

ERbool erHashTableInsert(ERHashTable *ht, const void *key, ERuint keySize, const void *value);
void erHashTableRemove(ERHashTable *ht, const void *key, ERuint keySize);
ERbool erHashTableSearch(ERHashTable *ht, const void *key, ERuint keySize, const void **value);

void erHashTableIterate(ERHashTable *ht, ERHashTableIterator *it);

#endif // ER_HASHTABLE_H
